package com.wuyou.designPatterns.iterator;

public class IteratorMain {

    public static void main(String[] args) {
        BookShelf bookShelf = new BookShelf(10);

        for (int i = 0; i < 10; i ++ ){
            bookShelf.appendBook(new Book("book-" + (i + 1)));
        }

        Iterator iterator = bookShelf.iterator();
        while (iterator.hasNext()) {
            Object obj = iterator.next();
            System.out.println(obj.toString());
        }

        BookShelfList<Book> bookShelfList = new BookShelfList<Book>(10);

        for (int i = 0; i < 10; i ++ ){
            bookShelfList.append(new Book("book-" + (i + 1)));
        }

        Iterator<Book> iterator1 = bookShelfList.iterator();
        while (iterator1.hasNext()) {
            Object obj = iterator1.next();
            System.out.println(obj.toString());
        }
    }
}
